<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
include '../tools/SignAndCheck.php';
//$input = file_get_contents("php://input");
$input = file_get_contents("php://input", 'r');
//这个是测试数据。如果异步不通外网可以直接用这个数据测试
$obj = json_decode($input, TRUE);
$signature = $obj['sign'];
$obj['sign'] = '';
$obj['sign_type'] = '';
$myfile = fopen("newfile.txt", "w");
$strData = getStr($obj);
if(verify($strData, $signature, '../cer/dev_pub.pem')){
	fwrite($myfile, "验证成功\n");
	if($obj['status'] == '00'){
		fwrite($myfile, "代付成功");
	}else if($obj['status'] == '01'){
		fwrite($myfile, "代付处理中");
	}else {
		fwrite($myfile, "代付失败");
	}
	$arr = array('resp_code'=>'000000');
	echo json_encode($arr);
}else{
	fwrite($myfile, "验证失败");
	$arr = array('resp_code'=>'999999');
	echo json_encode($arr);
}
?>

</body>
</html>